// 电子签章模块接口
import request from '@/utils/request'
import { commonBaseUrl } from '@/utils'

const moduleName = commonBaseUrl('A')

// 查询接口
export function getListApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/module/query',
        method: 'post',
        showLoading: true,
        data
    })
}

// 查询批量签章任务
export function queryBasicTask(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/queryBasicTask',
        method: 'post',
        showLoading: true,
        data
    })
}

export function insertBasicTask(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/insertBasicTask',
        method: 'post',
        showLoading: true,
        data
    })
}

// 验签接口
export function verifyFileKeyApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/verifyFileKey',
        showLoading: true,
        params
    })
}

// 作废接口
export function processCancelApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/processCancel',
        showLoading: true,
        params
    })
}

// 电子签章下载接口
export function downloadApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/module/download',
        method: 'post',
        showLoading: true,
        data
    })
}

// 导出接口
export function asyncExportApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/module/asyncExport',
        method: 'post',
        showLoading: true,
        data
    })
}

// 删除接口
export function delApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/module/del',
        params,
        showLoading: true
    })
}

// 校验是否本人数据/是否内部人员接口
export function checkPersonApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/module/checkPerson',
        params,
        hideMessage: true
    })
}

// 查询电子签章代办列表
// 查询接口
export function getTodoInfoApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/workFlow/getTodoInfo',
        showLoading: true,
        params
    })
}

// 提交电子签章待办流程
export function submitInstanceApi(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/workFlow/submitInstance',
        method: 'post',
        showLoading: true,
        data
    })
}

// 预览签署中的pdf
export function getSignFlowDocUrlsApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/getSignFlowDocUrls',
        showLoading: false,
        params
    })
}

// 获取签署流程信息
export function signDetailApi(params) {
    return request({
        url: moduleName + 'api/attachment/signatures/ele/signDetail',
        showLoading: false,
        params
    })
}

// 查询项目附件信息接口
export function queryProjectFile(data) {
  return request({
      url: moduleName + 'api/attachment/signatures/queryProjectFile',
      method: 'post',
      showLoading: true,
      data
  })
}

// 查询选择项目列表接口（采购经理发起非自主研发项目签章流程）
export function queryCompleteProject(data) {
  return request({
      url: moduleName + 'api/attachment/signatures/queryCompleteProject',
      method: 'post',
      showLoading: true,
      data
  })
}

// 保存选择的项目
export function addCompleteProject(data) {
  return request({
      url: moduleName + 'api/attachment/signatures/addCompleteProject',
      method: 'post',
      showLoading: true,
      data
  })
}

export function permissionBtnShow(data) {
    return request({
        url: moduleName + `api/attachment/signatures/checkPermissionPoint`,
        method: 'post',
        data,
        showLoading: true,
        hideMessage: true // 隐藏消息提示
    })
}

export function deleteIndependent(data) {
    return request({
        url: moduleName + 'api/attachment/signatures/deleteIndependent',
        method: 'post',
        showLoading: true,
        data
    })
}

// 电子签章下载接口
export function downloadFileData(data) {
  return request({
      url: moduleName + 'api/attachment/signatures/signDownload',
      method: 'post',
      responseType: 'blob',
      showLoading: false,
      data
  })
}
